# Maintainer: Felix Huettner <huettner94@gmx.de>

pkgname=whois
pkgver=5.2.9
pkgrel=1
pkgdesc="The whois client by Marco d'Itri"
arch=('i686' 'x86_64')
url="http://www.linux.it/~md/software/"
license=('GPL')
depends=('libcrypt' 'libidn' 'libiconv')
makedepends=('perl' 'libcrypt-devel' 'libidn-devel' 'libiconv-devel')
backup=('etc/whois.conf')
source=("http://ftp.debian.org/debian/pool/main/w/whois/${pkgname}_${pkgver}.tar.xz"
        "whois-libiconv.patch")
md5sums=('6bb5bf65bc24f1dc60059f69a930015c'
         '83c9949c4cb0d2f4837dc500e0d4a84d')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -i ${srcdir}/whois-libiconv.patch
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make prefix=/usr \
       CFLAGS="$CFLAGS $CPPFLAGS" \
       CONFIG_FILE=/etc/whois.conf \
       HAVE_LIBIDN=1 \
       HAVE_ICONV=1
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make prefix=/usr BASEDIR="${pkgdir}" install-whois
  install -D -m644 whois.conf "${pkgdir}/etc/whois.conf"
}
